/*************************************************************************
	> File Name: 5-6.c
	> Author: Angel Criss
	> Mail: abbytsing@gmail.com 
	> Created Time: Thu Jul 24 17:06:21 2014
 ************************************************************************/

struct dv{
    void *store;        // store the read bit
    size_t len;         // read/write length
}

size_t vread(int fd, const struct dv *io, int max)
{
    int i=0;

    while(i<max)
    {
        if(read(fd,io[i]->store,io->len)==-1)
            err("readv");
    }
}

size_t vwrite(int fd,const struct dv *io,int max)
{
    int i=0;
    while(i<max)
    {
        lseek(fd,0,SEEK_END);
        if(write(fd,io[i]->store,io->len)==-1)
            err("write");
    }
}
